package javabasics.designpattern.flyweight;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author suxiaoxiao
 * @Date 2019/6/1 15:23
 * @Version 1.0
 */
public class ReportManagerFactory {

    Map<String, IReportManager> financialReprotManager = new HashMap<String, IReportManager>();
    Map<String, IReportManager> employeeReportManager = new HashMap<String, IReportManager>();

    IReportManager getFinancialReportManager(String tenantId) {
        IReportManager r = financialReprotManager.get(tenantId);
        if (r == null) {
            r = new FinacialReprotManager(tenantId);
            financialReprotManager.put(tenantId, r);
        }
        return r;
    }

    IReportManager getEmployeeReportReportManager(String tenantId) {
        IReportManager r = employeeReportManager.get(tenantId);
        if (r == null) {
            r = new EmployeeReportManager(tenantId);
            employeeReportManager.put(tenantId, r);
        }
        return r;
    }

}
